public class Test {
    public static void main(String[] args) {
        System.out.println("a".matches("[abc]"));//true
        System.out.println("z".matches("[abc]"));//false


        System.out.println("a".matches("[^abc]"));//false
        System.out.println("z".matches("[^abc]"));//true

        System.out.println("a".matches("\\d"));//false
        System.out.println("3".matches("\\d"));//true
        System.out.println("333".matches("\\d"));//false
        System.out.println("z".matches("\\w"));//true
        System.out.println("2".matches("\\w"));//true
        System.out.println("21".matches("\\w"));//false
        System.out.println("你".matches("\\w"));//false


        //校验密码
        //必须是数字  字母  下划线 至少6位
        System.out.println("ssds3c".matches("\\w{6,}"));
        System.out.println("ssdsc".matches("\\w{6,}"));
        System.out.println("ssdsawdasdawd232aw你c".matches("\\w{6,}"));



        //验证码  必须是数字和字符  必须是四位数
        System.out.println("23dF".matches("[a-zA-Z0-9]{4}"));
        System.out.println("23_F".matches("[a-zA-Z0-9]{4}"));
        System.out.println("23dF".matches("[\\w&&[^_]]{4}"));
        System.out.println("23_F".matches("[\\w&&[^_]]{4}"));




    }
}
